package cn.edu.fzu.delivery.domain.enums;

/**
 * 快递类型
 * 
 * @author fangxin
 * @date 2022/11/2
 */
public enum CourierTypeEnum implements SpringConvertibleEnum {

    BOOK(0, "书籍"),
    CLOTH(1, "衣物"),
    DAILY_GOODS(2,"日常用品"),
    FOOD(3,"食品"),
    APPLIANCE(4,"家用电器"),
    ELECTRONICS(5,"电子器件"),
    FRAGILE(6,"易碎品"),
    LETTER(7,"信件"),
    OTHER(8,"其他");


    private final int    value;

    private final String desc;

    private CourierTypeEnum(int value, String desc) {
        this.value = value;
        this.desc = desc;
    }


    public int getValue() {
        return value;
    }


    public String getDesc() {
        return desc;
    }


    public static CourierTypeEnum parse(int value) {
        switch (value) {
            case 0:
                return BOOK;
            case 1:
                return CLOTH;
            case 2:
                return DAILY_GOODS;
            case 3:
                return FOOD;
            case 4:
                return APPLIANCE;
            case 5:
                return ELECTRONICS;
            case 6:
                return FRAGILE;
            case 7:
                return LETTER;
            case 8:
                return OTHER;
            default:
                return null;
        }
    }


    @Override
    public String toString() {
        return String.valueOf(getValue());
    }
}
